# Maintainer: Maxime Gauduin <alucryd@archlinux.org>
# Contributor: Christian Pfeiffer <cpfeiffer@live.de>

pkgname=libigl
pkgver=2.5.0
pkgrel=1
pkgdesc='Simple C++ geometry processing library'
arch=(any)
url=https://github.com/libigl/libigl
depends=(eigen)
makedepends=(
  cmake
  git
  ninja
)
license=(GPL3)
_tag=fdaac01bcc52888994f7afd029dcc045dd408484
source=(git+https://github.com/libigl/libigl.git#tag=${_tag})
b2sums=(SKIP)

pkgver() {
  cd libigl
  git describe --tags | sed 's/^v//'
}

build() {
  cmake -S libigl -B build -G Ninja \
    -DCMAKE_BUILD_TYPE=None \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DFETCHCONTENT_SOURCE_DIR_EIGEN=/usr/include/eigen3 \
    -DFETCHCONTENT_UPDATES_DISCONNECTED=ON \
    -DLIBIGL_BUILD_TESTS=OFF \
    -DLIBIGL_BUILD_TUTORIALS=OFF \
    -DLIBIGL_COPYLEFT_CGAL=OFF \
    -DLIBIGL_COPYLEFT_COMISO=OFF \
    -DLIBIGL_COPYLEFT_TETGEN=OFF \
    -DLIBIGL_EMBREE=OFF \
    -DLIBIGL_GLFW=OFF \
    -DLIBIGL_IMGUI=OFF \
    -DLIBIGL_OPENGL=OFF \
    -DLIBIGL_PNG=OFF \
    -DLIBIGL_PREDICATES=OFF \
    -DLIBIGL_RESTRICTED_MATLAB=OFF \
    -DLIBIGL_RESTRICTED_MOSEK=OFF \
    -DLIBIGL_RESTRICTED_TRIANGLE=OFF \
    -DLIBIGL_USE_STATIC_LIBRARY=OFF \
    -DLIBIGL_XML=OFF
  cmake --build build
}

package() {
  DESTDIR="${pkgdir}" cmake --install build
  rm -rf "${pkgdir}"/usr/{include/Eigen,lib/cmake/eigen}
}

# vim: ts=2 sw=2 et:
